<?php 
if((count($adc->getAdBrands()) > 0) && ($adc->getCurrentAdTypeId() > 0))
{
	?>
    <div class="control-group">
        <hr />
        <label><?php 
                if($txt->getWord('brands_'.$adc->getCurrentAdTypeId()) != 'brands_'.$adc->getCurrentAdTypeId())
                { echo ucfirst($txt->getWord('brands_'.$adc->getCurrentAdTypeId())); }
                else
                { echo ucfirst($txt->getWord('brands')); }
            ?></label><br />
            <div class="checkbox">
                <label for="brand_0"> 
                    <input name="brands[]" type="checkbox" <?php echo $txt->getIsCheckedHTML(0, $_REQUEST['brands']); ?> value="0" id="brand_0" onchange="jQuery('input.brands').removeAttr('checked'); jQuery('#pageNo').val(1);" onclick="$('input.brands').removeAttr('checked'); $('#pageNo').val(1);" /> <a class="command" onclick="$('input.brands').removeAttr('checked'); $('#pageNo').val(1); $('#search-ad-form').submit();"><?php echo ucfirst($txt->getWord('all')); ?></a>
                </label>
            </div>
			<?php
            foreach($adc->getAdBrands() as $brand)
            {
                $display = 0;
                if(($adc->getCurrentAdTypeId() > 5) && ($adc->getCurrentAdTypeId() == $brand->getTypeId()) && ($brand->getAdsCount() > 0))
                { $display = 1; }
                
                if(($brand->getAdsCount() > 1) && (($adc->getCurrentAdTypeId() == $brand->getTypeId()) || ($brand->getTypeId() == 0)))
                { $display = 1; }
                
                if($display > 0)
                {
                    ?>
                    <div class="checkbox">
                        <label for="brands"> 
                            <input name="brands[]" type="checkbox" class="brands"  <?php echo $txt->getIsCheckedHTML($brand->getId(), $_REQUEST['brands']); ?> value="<?php echo $brand->getId(); ?>" id="brand_<?php echo $brand->getId() ?>" onchange="jQuery('input#brand_0').removeAttr('checked'); " />
                            <?php if(strpos($_SERVER['REQUEST_URI'], 'q=') != false): ?>
                                <?php echo $brand->getTitle(); ?>
                            <?php else: ?>
                                <?php if($adc->getCurrentAdCatId() > 0): ?>
                                    <a href="/adcat/<?php echo $adc->getCurrentAdCatId(); ?>/adbrand/<?php echo $brand->getId() ?>/"><?php echo $brand->getTitle(); ?></a>
                                <?php else: ?>
                                    <a href="/adtype/<?php echo $adc->getCurrentAdTypeId(); ?>/adbrand/<?php echo $brand->getId() ?>/"><?php echo $brand->getTitle(); ?></a>
                                <?php endif;  ?>
                            <?php endif;  ?>
                        </label>
                    </div>
                    <?php 
                }
            }
            ?><br />
    		<button type="submit" class="btn <?php echo $adc->getSetting('SearchBtnClass'); ?>" name="search"><?php echo ucfirst($txt->getWord('search')); ?></button>
    </div>
    <?php
}
?>